﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Utilities;

namespace Models
{

    public class StockView : ViewBase
    {
        [Display(Name = "库存物")]
        public string StockName { get; set; }

        [Display(Name = "分类")]
        public string CategoryName { get; set; }

        [Display(Name = "仓库")]
        public string WarehouseName { get; set; }

        [Display(Name = "单位")]
        public string AreaName { get; set; }

        [Display(Name = "品质")]
        public string QualityName { get; set; }

        [Display(Name = "容量(吨)")]
        public double Volume { get; set; }

        [Display(Name = "比率")]
        public int Percentage { get; set; }

        [Display(Name = "同类物品数量")]
        public double CategoryTotal { get; set; }

        public StockView(Stock s)
        {
            StockName = s.StockName;
            CategoryName = s.Category.CategoryName;
            QualityName = s.Quality.QualityName;
            WarehouseName = s.Warehouse.WarehouseName;
            AreaName = s.Area.AreaName;
            Volume = s.Volume;
            ID = s.ID;
            Sequence = s.Sequence;
            Description = s.Description;
        }
    }

    public class Stock:EntityBase
    {
        [Display(Name = "品名")]
        public string StockName { get; set; }

        [Display(Name = "分类")]
        public virtual Category Category { get; set; }
        public int? CategoryID { get; set; }

        [Display(Name = "仓库")]
        public virtual Warehouse Warehouse { get; set; }
        public int? WarehouseID { get; set; }

        [Display(Name = "单位")]
        public virtual Area Area { get; set; }
        public int? AreaID { get; set; }

        [Display(Name="品质")]
        public virtual Quality Quality { get; set; }
        public int? QualityID  { get; set; }

        [Display(Name = "容量(吨)")]
        public double Volume { get; set; }
    }
}